home *** CD-ROM | disk | FTP | other *** search
/ Mesolore / Mesolore - Disc 1.iso / pc / data / Buttons.cst / 00047_Script_main movie script < prev    next >
Text File  |  2001-04-13  |  35KB  |  1,154 lines

  1.  
  2. Global gReturn
  3. Global gDebateAudio, gDebateText, gLectureVideo, gLectureText,gRetraceList,ghilitecolor,gpathDelimit,gwhichFrame,gShowText,gShowSearch
  4. Global   glastcoord, gshowGazeteer
  5. Global gsearchtxt, gSearchImg, gsearchmm,gDispatcher,gWhichMusic
  6.  
  7. on test
  8.   temp = field "glosslist"
  9.   repeat with x = 1 to the number of lines in temp
  10.     put x
  11.     searchGloss (line x of temp)
  12.   end repeat
  13.   
  14. end
  15.  
  16. on removeBlanksfromlist
  17.   temp = field "glosslist"
  18.   repeat with x = 1 to the number of lines in temp
  19.     repeat while the last char of line x of temp = " "
  20.       put line x of temp
  21.       delete char (the number of chars in line x of temp) of line x of temp
  22.     end repeat
  23.   end repeat
  24.   put temp into field "glosslist"
  25.   beep
  26. end
  27.  
  28.  
  29. global gDefinition 
  30. on glossarize
  31.   repeat with y = 196 to 196
  32.     whichField = member y
  33.     put whichfield
  34.     temp = field "glosscompare"
  35.     hMany = the number of lines in temp
  36.     if the type of member y = #field then
  37.       --set the forecolor of field whichField = 255
  38.       
  39.       SearchField = Field whichField
  40.       fullField = SearchField
  41.       fullFieldChars = the number of chars in fullField
  42.       addOn = 0 --- if searching the rest of a field
  43.       repeat with x = 1 to hMany
  44.         
  45.         searchword = line x of temp
  46.         --put searchword
  47.         if searchField contains SearchWord then
  48.           --          put searchword
  49.           start = offset(searchWord, searchField) + addOn
  50.           finish  = start + (the number of chars in searchword) -1
  51.           ---check end---
  52.           --          put the number of chars in searchfield && finish
  53.           if "()[]!/,. ;:?_-'" & quote & return contains char (finish +1) of fullField or finish = fullFieldChars then
  54.             ---check start---
  55.             if "()[]!/,. ;:?_-┐'" & quote & return contains char start-1 of fullField or start = 1 then
  56.               set the forecolor of char start to finish  of field whichField to 15
  57.               addOn = 0
  58.               SearchField = fullField
  59.               next repeat
  60.               
  61.             end if
  62.           end if 
  63.           ---continue searching in the rest of the text
  64.           searchfield = char finish +1 to (fullFieldChars) of fullField
  65.           if the number of chars in searchfield = 0 then
  66.             addOn = 0
  67.             SearchField = fullField
  68.             next repeat
  69.           end if
  70.           -- put searchword && searchfield
  71.           addon = finish
  72.           x = x-1
  73.         else
  74.           addOn = 0
  75.           SearchField = fullField
  76.         end if
  77.         
  78.         
  79.       end repeat
  80.     else
  81.       next repeat
  82.     end if
  83.   end repeat
  84.   beep
  85. end 
  86.  
  87. on glossarizetext
  88.   repeat with y = 211 to 244
  89.     whichField = member y
  90.     put whichfield
  91.     if the type of member y = #text then
  92.       --set the forecolor of field whichField = 255
  93.       temp = field "glosscompare"
  94.       hMany = the number of lines in temp
  95.       SearchField = the text of whichField
  96.       repeat with x = 1 to hMany
  97.         searchword = line x of temp
  98.         if searchField contains SearchWord then
  99.           --          put searchword
  100.           start = offset(searchWord, searchField)
  101.           finish  = start + (the number of chars in searchword) -1
  102.           if ",. ;:?" contains char (finish +1) of SearchField then
  103.             if char start-1 of SearchField = " " then
  104.               set the forecolor of char start to finish  of member 211 to 15
  105.             end if
  106.           end if 
  107.         end if
  108.         
  109.       end repeat
  110.     else
  111.       next repeat
  112.     end if
  113.   end repeat
  114.   beep
  115. end 
  116.  
  117. on ick
  118.   repeat with y = 1 to 34
  119.     put  "4:goto " &  QUOTE & y  
  120.   end repeat
  121.   
  122. on LibLink which
  123.   -- which = capIt(which)
  124.   --gotoNetPage("http://www.steveblakedesign.com/" & which) 
  125.   if the type of the member of sprite 4 = #quickTimeMedia then
  126.     sprite(4).movierate = 0
  127.   end if
  128.   if the type of the member of sprite 8 = #quickTimeMedia then
  129.     sprite(8).movierate = 0
  130.   end if
  131.   gotoNetPage("http://www.mesolore.com/library/advanced/" & which)  
  132. end
  133.  
  134. on capIt which
  135.   repeat with x = 1 to the number of chars in which
  136.     if chartonum(char x of which) >= 97 and chartoNum(char x of which) <= 122 then
  137.       put numToChar(chartonum(char x of which)-32) into char x of which
  138.     end if
  139.   end repeat
  140.   return which
  141. end
  142.  
  143. on showSprite which
  144.   repeat with x in which
  145.     if sprite(x).locH < 0 then
  146.       sprite(x).locH = sprite(x).locH +1000
  147.     end if
  148.   end repeat
  149.   updatestage
  150. end
  151.  
  152. on hideSprite which
  153.   repeat with x in which
  154.     if sprite(x).locH > 0 then
  155.       sprite(x).locH = sprite(x).locH -1000
  156.     end if
  157.   end repeat
  158.   updatestage
  159. end
  160. on PrintIt where
  161.   set doc = new(xtra "PrintOMatic_Lite")
  162.   if not objectP(doc) then exit
  163.   temp = char 1 to (offset(".",the movie))-1 of the movie
  164.   case (temp) of
  165.     "debates","tutorial","lecture","glossary","notepad": x = 3
  166.     "atlas":x =8
  167.     "text":x = 3
  168.     "nuttall search":x = 9
  169.     "selden search":x = 9
  170.     otherwise
  171.       x=3
  172.   end case
  173.   
  174.   If the membernum of the member of sprite x >0 then
  175.     if "#text #field" contains string(the type of member (the member of sprite x)) then
  176.       append doc, member(the member of sprite x), TRUE
  177.       append doc, RETURN & RETURN & "Mesolore, Bakewell and Hamann,⌐Brown University 2001", TRUE
  178.       if (the optiondown) then
  179.         if doJobSetup (doc) = TRUE then 
  180.           printpreview doc
  181.         end if
  182.       else
  183.         if doJobSetup (doc) = TRUE then 
  184.           print doc
  185.         end if
  186.       end if
  187.     else
  188.       alert "Sorry, nothing to print."
  189.       
  190.       
  191.     end if
  192.   else
  193.     alert "Sorry, nothing to print."
  194.   end if
  195.   set doc = 0
  196. end
  197.  
  198. on stripDoubles --- from indexterms
  199.   temp = the text of member"indexterms"
  200.   hold = ""
  201.   newlist = ""
  202.   repeat  with x = 1 to the number of lines of temp
  203.     if line x of temp = hold then
  204.     else
  205.       put line x of temp & RETURN after newList
  206.       hold = line x of temp
  207.     end if
  208.   end repeat
  209.   put newList into field "indexterms2"
  210. end 
  211.  
  212. on ww 
  213.   temp = the text of member"masterindex"
  214.   newlist = ""
  215.   repeat  with x = 1 to the number of lines of temp
  216.     if line x of temp contains "debates.dir" then
  217.       put line x of temp & RETURN after newList
  218.     end if
  219.   end repeat
  220.   put newList --into field "indexterms2"
  221. end 
  222.  
  223. on scrollGloss whichline
  224.   where = getAt(charPosToLoc(member "glosslist", value(whichLine)),2)  - the lineheight of  member "glosslist"
  225.   sendSprite(11,#CustomScrollbar_SetScroll,where)
  226. end
  227.  
  228.  
  229. on checkGloss
  230.   put false into triedIt
  231.   put the mousechar into gActivechar
  232.   put empty into gDefinition 
  233.   put the mousecast into gSearchField 
  234.   if gActivechar = -1 then abort
  235.   if the forecolor of char gActivechar of field gSearchField = 15 or the forecolor of char gActivechar of field gSearchField = 31 then
  236.     put the forecolor of char gActivechar of field gSearchField into whichColor
  237.     put gActivechar into Start
  238.     put gActivechar into end
  239.     if gActivechar > 1 then
  240.       repeat with x = 1 to 50 --- Look for red chars to left 
  241.         if the forecolor of char gActivechar - x of field gSearchField = whichColor then
  242.           put max(1,gActivechar - x) into Start
  243.         else
  244.           exit repeat
  245.         end if
  246.       end repeat
  247.     end if
  248.     repeat with x = 1 to 50 --- Look for red chars to right 
  249.       if the forecolor of char gActivechar + x of field gSearchField = whichColor then
  250.         put gActivechar + x into end
  251.       else
  252.         exit repeat
  253.       end if
  254.     end repeat
  255.     if not(the movie contains "atlas") then
  256.       hilite char start to end of field gSearchField
  257.     end if
  258.     put char start to end of field gSearchField into gSearchWord
  259.     repeat while the last char of gSearchWord = "_"
  260.       delete char (the number of chars in gSearchWord) of gSearchWord
  261.     end repeat
  262.     repeat while the last char of gSearchWord = " "
  263.       delete char (the number of chars in gSearchWord) of gSearchWord
  264.     end repeat
  265.     put gsearchword
  266.     searchGloss gsearchword
  267.     
  268.   end if
  269. end
  270.  
  271.  
  272. on searchGloss(which)
  273.   set the itemdelimiter = "#"
  274.   tempa = field "xref"
  275.   hmanya = the number of lines in tempa
  276.   repeat with y = 1 to hmanya
  277.     if item 1 of line y of tempa = which then
  278.       findDef(value(item 2 of line y of tempa))
  279.       
  280.       exit repeat
  281.     end if
  282.   end repeat
  283.   if y > hmanya then put which
  284.   set the itemdelimiter = "#"
  285. end
  286.  
  287. on findDef(whichline)
  288.   temp = ""
  289.   repeat with x = whichline + 1 to 10000
  290.     if line x of field "glossdef" <> "" then
  291.       put line x of field "glossdef" & RETURN after temp
  292.     else
  293.       exit repeat
  294.     end if
  295.   end repeat
  296.   if the movie contains "glossary" then
  297.     sprite(3).visible = FALSE
  298.     put temp into field "result"
  299.     setBold
  300.     sprite(3).visible = TRUE
  301.   else
  302.     open window "Definition"
  303.     set the windowtype of window "definition" = 4
  304.     tell window "definition" to sprite(3).visible = False
  305.     tell window "definition" to put temp into field "result"
  306.     tell window "definition" to setBold
  307.     tell window "definition" to sprite(3).visible = TRUE
  308.   end if
  309.   
  310. end
  311.  
  312. on setBold
  313.   temp = field "result"
  314.   set the fontStyle of field "result" = "plain"
  315.   repeat with x = 1 to the number of lines in field "result"
  316.     if line x of temp contains ":" then
  317.       set the fontStyle of char 1 to (offset(":",line x of temp)) of line x of field "result" = "Bold"
  318.       if x <> 1 and not(line x-1 of field "result" contains ":") then
  319.         put RETURN after line x-1 of field "result"
  320.       end if
  321.     end if
  322.     
  323.   end repeat
  324. end
  325.  
  326.  
  327. on gg --gloss index
  328.   set the itemDelimiter = "#"
  329.   put "" into field "hits"--xref
  330.   temp = field "misses" -- "glosslist_hidden"
  331.   
  332.   tempa = field "glossdef"
  333.   hmany = the number of lines in temp
  334.   put hmany
  335.   hmanya = the number of lines in tempa
  336.   repeat with x = 1 to hmany
  337.     put x
  338.     sWord = line x of temp
  339.     --put sword
  340.     found = FALSE
  341.     repeat with y = 1 to hmanya
  342.       if line y of tempa contains "#" or line y-1 of tempa = "" then
  343.         repeat with i = 1 to the number of items in line y of tempa
  344.           if item i of line y of tempa = sword then
  345.             put sword & "#" & y & RETURN after field "hits" -- "xref"
  346.             found = TRUE
  347.           end if
  348.         end repeat
  349.       end if
  350.       if found = TRUE then exit repeat
  351.     end repeat
  352.     if y = hmanya then
  353.       put sword
  354.     end if
  355.   end repeat
  356.   
  357.   set the itemDelimiter = ","
  358.   
  359. end
  360.  
  361. on yy
  362.   set the itemDelimiter = "#"
  363.   repeat with y = 40 to 49
  364.     temp = the text of member y
  365.     hMany = the number of lines in temp
  366.     repeat with x = 1 to hMany
  367.       target = item 1 of line x of temp
  368.       put target & "                                                             " into item 1 of line x of temp
  369.     end repeat
  370.     the text of member y = temp
  371.   end repeat
  372.   set the itemDelimiter = ","
  373. end
  374.  
  375. on zz
  376.   set the itemDelimiter = "#"
  377.   --  repeat with y = 40 to 49
  378.   temp = field "indexterms"
  379.   hMany = the number of lines in temp
  380.   repeat with x = 1 to hMany
  381.     target = item 1 of line x of temp
  382.     put target into line x of temp
  383.   end repeat
  384.   put temp into field "indexterms"
  385.   --  end repeat
  386.   set the itemDelimiter = ","
  387. end
  388.  
  389.  
  390.  
  391. on xx
  392.   repeat with y = 17 to 26
  393.     put the text of member value(y) & RETURN after field "list"
  394.     
  395.   end repeat
  396.   
  397. end
  398. on showscroll
  399.   put the scrolltop of the member of sprite 3
  400. end
  401.  
  402. on expandMenu which, who 
  403.   sprite(2).member = which & who 
  404.   updatestage
  405.   sendSprite(10, #CustomScrollbar_SwapMember,the member of sprite 2)
  406.   sendSprite(11, #CustomScrollbar_SwapMember,the member of sprite 2)
  407.   sendSprite(12, #CustomScrollbar_SwapMember,the member of sprite 2)
  408.   sendSprite(13, #CustomScrollbar_SwapMember,the member of sprite 2)
  409.   if "rivera, valdes,magd,stav,ponia,tibol,lopez" contains who then
  410.     tlang="-spn" 
  411.   else
  412.     tlang= "-eng"
  413.   end if
  414.   temp = findxname(who)& "_" & (char 1 to 2 of which) & tlang
  415.   the member of sprite 3 =temp
  416.   updatestage
  417.   sendSprite(15, #CustomScrollbar_SwapMember,the member of sprite 3)
  418.   sendSprite(16, #CustomScrollbar_SwapMember,the member of sprite 3)
  419.   sendSprite(17, #CustomScrollbar_SwapMember,the member of sprite 3)
  420.   sendSprite(18, #CustomScrollbar_SwapMember,the member of sprite 3)
  421.   sendSprite(16,#CustomScrollbar_SetScroll,0)
  422.   sendSprite(10,#CustomScrollbar_SetScroll,0)
  423. end
  424.  
  425. on findxname(who)
  426.   temp = ""
  427.   hold = field "namesxref"
  428.   hmany = the number of lines in hold
  429.   the itemdelimiter = "#"
  430.   repeat with x = 1 to hmany
  431.     if line x of hold contains who then
  432.       return item 2 of line x of hold
  433.       exit repeat
  434.     end if
  435.   end repeat
  436.   the itemdelimiter = ","
  437. end
  438.  
  439. on resetMenu which
  440.   sprite(8).visible = 0
  441.   sprite(2).member = which
  442.   sendSprite(10, #CustomScrollbar_SwapMember,the member of sprite 2)
  443.   sendSprite(11, #CustomScrollbar_SwapMember,the member of sprite 2)
  444.   sendSprite(10,#CustomScrollbar_SetScroll,0)
  445.   temp = "sum_" & which & "_eng"
  446.   the member of sprite 3 =temp
  447.   sendSprite(16, #CustomScrollbar_SwapMember,the member of sprite 3)
  448.   sendSprite(16,#CustomScrollbar_SetScroll,0)
  449. end
  450.  
  451. on getlines
  452.   put "" into field "textwindowlist"
  453.   tell window "selden text" to set temp = field "info"
  454.   repeat with x = 1 to 20
  455.     repeat with y = 1 to the number of lines in temp
  456.       if line y of temp contains "Page" and line y of temp contains string(x) then
  457.         exit repeat
  458.       end if
  459.     end repeat
  460.     put y-1 & RETURN after field "textwindowlist"
  461.   end repeat
  462.   
  463. end
  464.  
  465. on setloc
  466.   beginrecording
  467.     repeat with y = 798 to 798
  468.       go frame y
  469.       if the membernum of sprite 2 <> 0 then
  470.         move y
  471.       end if
  472.     end repeat
  473.   endrecording
  474. end
  475.  
  476. on FIXfields
  477.   repeat with x = 947 to 1975 ---767 to 800 
  478.     
  479.     go frame x
  480.     if the membernum of sprite 30 <> 0 then
  481.       put x
  482.       if char 1 of line 1 of FIELD the member of sprite 30 = "N" then
  483.         delete line 1 of FIELD the member of sprite 30
  484.         repeat with y = 1 to 100
  485.           if line 1 of FIELD the member of sprite 30 = "" then
  486.             delete line 1 of FIELD the member of sprite 30
  487.           else
  488.             exit repeat
  489.           end if
  490.         end repeat
  491.       END IF
  492.     end if
  493.   end repeat
  494. end
  495.  
  496. on setfields
  497.   repeat with x = 765 to 1500
  498.     put x
  499.     go frame x
  500.     if the membernum of sprite 30 <> 0 then
  501.       set the forecolor of the member of sprite 30 = 79
  502.       set the border of the member of sprite 30 = 0
  503.       updatestage
  504.     end if
  505.   end repeat
  506. end
  507.  
  508.  
  509. on move which
  510.   go frame which
  511.   set a =  point(419,250) - the loc of sprite 2
  512.   set the loc of sprite 2 = point(419,250)
  513.   repeat with x = 5 to 29
  514.     if the membernum of sprite x <> 0 then
  515.       set b = the loc of sprite x
  516.       set the loc of sprite x = a + b
  517.       
  518.     end if
  519.   end repeat
  520.   updatestage
  521. end
  522.  
  523. on preparemovie
  524.   if gRetraceList = void then set gRetraceList       = ["home*Intro" ]
  525.   browsername()
  526.   if the movie contains "debate" then
  527.     sprite(8).visible = 0
  528.   end if
  529.   
  530.   
  531.   if the machinetype = "256" then
  532.     set gpathDelimit = "\"
  533.   else
  534.     set gpathDelimit = ":"
  535.   end if
  536.   
  537.   glastcoord = ""
  538.   gshowGazeteer = FALSE
  539.   gsearchtxt = TRUE
  540.   gSearchImg= TRUE
  541.   gSearchmm=TRUE
  542.   
  543.   
  544.   sprite(100).visible = 0 ---menu sprite
  545.   sprite(101).visible = 0 
  546.   set gDebateAudio = TRUE
  547.   set gDebateText = TRUE
  548.   
  549.   
  550.   if the movie contains "nuttall" or the movie contains "selden" or the movie contains "tutorial" or the movie contains "debate" then
  551.     nothing
  552.   else
  553.     hmany = the number of members of castlib 1        
  554.     repeat with x = 1 to hMany
  555.       if the type of member x = #field then
  556.         set the scrolltop of member x = 0
  557.       end if
  558.     end repeat
  559.   end if
  560.   if voidp(gdispatcher) then 
  561.     gDispatcher = new(script "dispatcher")
  562.     
  563.   end if
  564. end
  565.  
  566.  
  567.  
  568.  
  569.  
  570. on setupMIAW windowName, windowFile, wType
  571.   --  set the fileName of window windowName to windowFile
  572.   --  if wtype= "void" then
  573.   --    set the windowType of window windowName to 2
  574.   --  else
  575.   --    set the windowType of window windowName to wType
  576.   --  end if
  577. end setupMIAW
  578.  
  579.  
  580. on keyDown
  581.   if the movie contains "intro" then
  582.     go "kill"
  583.     
  584.   else
  585.     if the platform contains "macintosh" then
  586.       if (the optiondown)  then
  587.         case (the keypressed) of
  588.             
  589.             --"s":   tell the stage to playSeldenLoop
  590.           "f":     tell the stage to alert(string((the freebytes/1000000)))
  591.           "m":    tell the stage to playMusic
  592.           "o":   tell the stage to showOrder
  593.           "t":   tell the stage to showText
  594.           "b":   tell the stage to showballoons
  595.         end case
  596.       end if
  597.     else
  598.       if (the commandDown)  then
  599.         case (the keypressed) of
  600.             
  601.             --"s":   tell the stage to playSeldenLoop
  602.           "m":   tell the stage to  playMusic
  603.           "o":   tell the stage to showOrder
  604.           "t":   tell the stage to showText
  605.           "b":   tell the stage to showballoons
  606.         end case
  607.       end if
  608.     end if
  609.   end if
  610.   
  611. end
  612. on playMusic
  613.   if soundBusy(3) or soundBusy(4)then
  614.     puppetsound 3,0
  615.     puppetsound 4,0
  616.   else
  617.     if gWhichMusic = "selden" then
  618.       puppetsound 4,"NutallLoop"
  619.       gWhichMusic = "nuttall"
  620.     else
  621.       puppetsound 3,"SELDENLOOP"
  622.       gWhichMusic = "selden"
  623.     end if
  624.   end if
  625. end
  626.  
  627.  
  628. on closeWindow
  629.   put the activewindow
  630.   if the activeWindow = (window "Nuttall Text") then
  631.     gShowText = FALSE
  632.   end if
  633.   if the activeWindow = (window "Selden Text") then
  634.     gShowText = FALSE
  635.   end if
  636.   
  637.   if (string(the activewindow) contains "bookmarks") or (string(the activewindow) contains "notepad") then
  638.     nothing
  639.   else
  640.     forget the activewindow
  641.   end if
  642.   
  643.   
  644. end
  645.  
  646. on stopMovie
  647.   if the movie contains "atlas" then
  648.     if windowpresent("select a site") then
  649.       close window("select a site")
  650.     end if
  651.   end if
  652.   
  653.   sound stop 1
  654.   sound close 1
  655. end
  656.  
  657. on flashLine
  658.   --  put the mouseLine
  659.   put the mouseline into clickLine
  660.   --  if the machinetype = "256" then
  661.   --    if clickline = -1 then abort
  662.   --    set thisField = member(the mousemember)
  663.   --    -- put the forecolor of line clickLine of member thisField
  664.   --    if the forecolor of line clickLine of member thisField <> 255 then
  665.   --      --      set the forecolor of line clickLine of member thisField to 255
  666.   --      --      updatestage
  667.   --    else pass
  668.   --    
  669.   --    repeat while the mouseDown
  670.   --      if the mouseLine <> clickline  then
  671.   --        if clickline <> "" then set the forecolor of line clickLine of member thisField to 15
  672.   --        put the mouseline into clickLine
  673.   --        put clickline
  674.   --        if the forecolor of line clickLine of member thisField <> 255 then
  675.   --          set the forecolor of line clickLine of member thisField to 255
  676.   --        else set clickLine = ""
  677.   --        updatestage
  678.   --      end if
  679.   --    end repeat
  680.   --    if clickline <> "" then set the forecolor of line clickLine of member thisField to 15
  681.   --    updatestage
  682.   --    if member(the mousemember) <> member thisField or the mouseLine <> clickLine then abort
  683.   --    return clickline
  684.   --  else
  685.   --    if clickline = -1 then abort
  686.   --    set thisField = member(the mousemember)
  687.   --    --  put the forecolor of line clickLine of member thisField
  688.   --    if the forecolor of line clickLine of member thisField <> 0 then
  689.   --      set the forecolor of line clickLine of member thisField to 0
  690.   --      updatestage
  691.   --    else pass
  692.   --    repeat while the mouseDown
  693.   --      if the mouseLine <> clickline  then
  694.   --        if clickline <> "" then set the forecolor of line clickLine of member thisField to 19456
  695.   --        put the mouseline into clickLine
  696.   --        put clickline
  697.   --        if the forecolor of line clickLine of member thisField <> 0 then
  698.   --          set the forecolor of line clickLine of member thisField to 0
  699.   --        else set clickLine = ""
  700.   --        updatestage
  701.   --      end if
  702.   --    end repeat
  703.   --    if clickline <> "" then set the forecolor of line clickLine of member thisField to 19456
  704.   --    updatestage
  705.   --    if member(the mousemember) <> member thisField or the mouseLine <> clickLine then abort
  706.   return clickline
  707.   --  end if
  708. end
  709.  
  710. on retrace
  711.   if count( gRetraceList ) > 1 then
  712.     deleteAt( gRetraceList, count( gRetraceList ))
  713.     set dest = ( getLast( gRetraceList ))
  714.     set the itemdelimiter = "*"
  715.     goTo item 1 of dest, item 2 of dest
  716.     set the itemdelimiter = ","
  717.     deleteAt( gRetraceList, count( gRetraceList ))
  718.     
  719.   else
  720.     beep
  721.   end if
  722.   cursor 0
  723. end retrace
  724.  
  725. on radio which
  726.   case (which) of
  727.     "tm":
  728.       set the hilite of member "tm" = true
  729.       set the hilite of member "t" = false
  730.       set the hilite of member "m" = false
  731.       set gMmMode = "tm"
  732.       set the visible of sprite 3 = true
  733.     "t":
  734.       set the hilite of member "t" = true
  735.       set the hilite of member "m" = false
  736.       set the hilite of member "tm" = false
  737.       sound stop 1
  738.       set gMmMode = "t"
  739.       set the visible of sprite 3 = true
  740.     "m":
  741.       set the hilite of member "m" = true
  742.       set the hilite of member "t" = false
  743.       set the hilite of member "tm" = false
  744.       set the visible of sprite 3 = false
  745.       --      set the member of sprite 3 = "text placeholder"
  746.       updatestage
  747.       set gMmMode = "m"
  748.   end case
  749.   updatestage
  750. end
  751.  
  752.  
  753. on playMM who, lineNum, audioNum
  754.   if audionum > 0 then
  755.     sprite(8).movierate = 0
  756.     sprite(8).movietime = 0
  757.     sprite(8).visible = 1
  758.   end if
  759.   put char 1 to (offset("_", who)-1) of who
  760.   --  set the text of the member of sprite 3 =  the text of member who
  761.   --  
  762.   set the  member of sprite 3 =  member who
  763.   
  764.   sendSprite(15, #CustomScrollbar_SwapMember,the member of sprite 3)
  765.   sendSprite(16, #CustomScrollbar_SwapMember,the member of sprite 3)
  766.   sendSprite(17, #CustomScrollbar_SwapMember,the member of sprite 3)
  767.   sendSprite(18, #CustomScrollbar_SwapMember,the member of sprite 3)
  768.   updatestage
  769.   where = getAt(charPosToLoc(member who, lineNum),2)  - the lineheight of  member who
  770.   sendSprite(16,#CustomScrollbar_SetScroll,where)
  771.   set the visible of sprite 3 = gDebateText
  772.   
  773.   updatestage
  774.   if gDebateAudio = TRUE and not voidp(audioNum)  then
  775.     break = offset("_", who)
  776.     section = char (break +1) to (break +2) of who
  777.     who = char 1 to (break -1) of who
  778.     put the pathName & "audio" & gpathDelimit & who & "0" & audionum  & "-" & section & ".mov"
  779.     set the filename of member "audio placeholder" = the pathName & "audio" & gpathDelimit & who & "0" & audionum  & "-" & section & ".mov"
  780.     set the movieRate of sprite 8 = 1
  781.   end if
  782.   
  783. end
  784.  
  785. on playLect who, lineNum, audioNum
  786.   if gLectureVideo = false and gLectureVideo = false then
  787.     gLectureText= true
  788.     gLectureVideo =true
  789.     sprite(3).visible=true
  790.     sprite(4).visible=true
  791.     set the member of sprite 5 = "check_x"
  792.     set the member of sprite 6 = "check_x"
  793.   end if
  794.   set the movieRate of sprite 4 = 0
  795.   --  put char 1 to (offset("_", who)-1) of who
  796.   set  the member of sprite 3 =   who
  797.   set the visible of sprite 3 = gLectureText
  798.   updatestage
  799.   sendSprite(15, #CustomScrollbar_SwapMember,the member of sprite 3)
  800.   sendSprite(16, #CustomScrollbar_SwapMember,the member of sprite 3)
  801.   sendSprite(17, #CustomScrollbar_SwapMember,the member of sprite 3)
  802.   sendSprite(18, #CustomScrollbar_SwapMember,the member of sprite 3)
  803.   updatestage
  804.   where = getAt(charPosToLoc(member who, lineNum),2)  - the lineheight of  member who
  805.   sendSprite(16,#CustomScrollbar_SetScroll,where)
  806.   --sendSprite(16,#CustomScrollbar_SetScroll,lineNum)
  807.   updatestage
  808.   if gLectureVideo = TRUE then
  809.     if audioNum = 0 then
  810.       nothing
  811.     else
  812.       if who contains "jansen-" then
  813.         if who contains"_eng" then
  814.           holder = "_spn"
  815.         else
  816.           holder = "_eng"
  817.         end if
  818.       else
  819.         holder=who
  820.       end if
  821.       break = offset("_", who)
  822.       section = char (break +1) to (break +2) of who
  823.       who = char 1 to (break -1) of who
  824.       if audioNum < 10 then audionum = "0" & audionum
  825.       set the filename of the member of sprite 4 = the pathName & "video" & gpathDelimit & who  & audionum  & ".mov"
  826.       put holder
  827.       if holder contains "_eng" then
  828.         settrackEnabled(sprite 4, 2,true)
  829.         settrackEnabled(sprite 4, 3,false)
  830.       else
  831.         settrackEnabled(sprite 4, 2,false)
  832.         settrackEnabled(sprite 4, 3,true)
  833.       end if
  834.       
  835.       set the movieRate of sprite 4 = 1
  836.     end if
  837.   end if
  838.   
  839. end
  840.  
  841. on buildIndex
  842.   
  843.   newlist = ""
  844.   temp = the text of member "masterIndex"
  845.   hmany = the number of lines of temp
  846.   hold = the text of member "indexterms"
  847.   holdhmany = the number of lines of hold
  848.   
  849.   repeat with x = 1 to holdhmany
  850.     searchword = line x of hold
  851.     repeat with y = 1 to hmany
  852.       if line y of temp contains searchword then   
  853.         put searchword & "                                   #" & y & return after newlist
  854.         put searchword
  855.         exit repeat 
  856.       end if
  857.     end repeat
  858.     
  859.   end repeat
  860.   put newlist into field "indexterms2"
  861.   beep
  862. end
  863. on scrollIndex whichline
  864.   where = getAt(charPosToLoc(member "indexterms", value(whichLine)),2)  - the lineheight of  member "indexterms"
  865.   sendSprite(11,#CustomScrollbar_SetScroll,where)
  866. end
  867.  
  868.  
  869. on searchIndex(which)
  870.   --  ttime = the ticks
  871.   --  put the ticks - ttime 
  872.   cursor 4
  873.   set the itemDelimiter = "#"
  874.   if voidp(which) then --- if clicked directly on searchList
  875.     clickline = the mouseline
  876.     Searchword = (item 1 of line clickline of field "indexterms2")
  877.     Searchindexes(Searchword,item 2 of line clickline of field "indexterms2")
  878.   else
  879.     Searchword = which --- search from enter a word
  880.     temp = field "searchList"
  881.     holder = []
  882.     hmany = the number of lines of temp
  883.     repeat with y = 1 to hmany
  884.       if line y of temp contains Searchword then
  885.         append holder, item 1 of line y of temp
  886.       end if
  887.     end repeat
  888.     put holder
  889.     repeat with target in holder
  890.       put target
  891.       if the mouseDown then abort
  892.       Searchindexes (target,getIndexline(target))
  893.     end repeat
  894.   end if
  895.   set the itemDelimiter = ","
  896.   beep
  897.   cursor 0
  898.   --  put the ticks - ttime
  899. end
  900.  
  901. on getIndexline(target)
  902.   temp = field"indexterms2"
  903.   hmany = the number of lines in temp
  904.   the itemdelimiter = "#"
  905.   repeat with x = 1 to hmany
  906.     if line x of temp contains target then
  907.       return item 2 of line x of temp
  908.       exit repeat
  909.     end if
  910.   end repeat
  911.   
  912. end 
  913.  
  914.  
  915. on findMatch ss
  916.   set the itemDelimiter = ":"
  917.   temp = the text of member "xref_index"
  918.   repeat with x = 1 to the number of lines in temp
  919.     if line x of temp contains ss then
  920.       holder = line x of temp 
  921.       return item 2 of holder
  922.       exit repeat
  923.     end if
  924.   end repeat
  925.   return ""
  926.   set the itemDelimiter = "#"
  927. end
  928.  
  929. on Searchindexes (searchword,whichLine)--- clicked on searchlist
  930.   repeat while the last char of searchword =" "
  931.     delete the last char of searchword
  932.   end repeat
  933.   vvideo=""
  934.   vaudio=""
  935.   vText=""
  936.   vImage=""
  937.   
  938.   
  939.   temp = the text of member "masterIndex"
  940.   hmany = the number of lines of temp
  941.   flag=FALSE
  942.   repeat with y = value(whichLine) to hmany
  943.     if line y of temp contains searchword & " " then   
  944.       flag = TRUE
  945.       set targetLine = line y of temp
  946.       ss = char (offset("#", targetLine )+1) to (the number of chars of targetline) of targetline
  947.       if targetline contains "image" then
  948.         put findMatch(ss)  after vImage
  949.         set the itemDelimiter = "#"
  950.         put "                                                                                                       #" & item 2 to 4 of targetLine  & return after vImage
  951.         
  952.       else if targetline contains "text" then
  953.         put findMatch(ss)  after vtext
  954.         set the itemDelimiter = "#"
  955.         put "                                                                                                       #" & item 2 to 4 of targetLine  & return after vtext
  956.         
  957.       else if targetline contains "audio" then
  958.         put findMatch(ss)  after vaudio
  959.         set the itemDelimiter = "#"
  960.         put "                                                                                                       #" & item 2 to 4 of targetLine  & return after vaudio
  961.         
  962.       else if targetline contains "video" then
  963.         put findMatch(ss)  after vvideo
  964.         set the itemDelimiter = "#"
  965.         put "                                                                                                       #" & item 2 to 4 of targetLine  & return after vvideo
  966.         
  967.       end if
  968.     else
  969.       if flag =TRUE then
  970.         flag = false
  971.         exit repeat
  972.       end if
  973.       
  974.     end if
  975.   end repeat
  976.   
  977.   repeat with x in ["Image","Video","Audio","Text"]
  978.     
  979.     if value(("v" & x)) <> "" then
  980.       case (x) of
  981.         "image": if gSearchImg = FALSE then next repeat
  982.         "Video": if gSearchmm = FALSE then next repeat
  983.         "Audio": if gSearchmm = FALSE then next repeat
  984.         "Text": if gSearchtxt = FALSE then next repeat
  985.           
  986.       end case
  987.       put Searchword & " (" & x & ")" & RETURN  after field "results"
  988.       set the forecolor of line (the number of lines of field "results") -1 of field "results" = 255
  989.       set the fontStyle of line (the number of lines of field "results") -1 of field "results" = "bold"
  990.       --stripsearchDoubles(x) 
  991.       put value( "v"&x) & RETURN after field "results"
  992.     end if
  993.   end repeat
  994.   
  995.   --  sendSprite(15, #CustomScrollbar_SwapMember,the member of sprite 2)
  996.   sendSprite(16, #CustomScrollbar_SwapMember,the member of sprite 2)
  997.   --  sendSprite(17, #CustomScrollbar_SwapMember,the member of sprite 2)
  998.   --  sendSprite(18, #CustomScrollbar_SwapMember,the member of sprite 2)
  999.    sendSprite(16,#CustomScrollbar_SetScroll,10000)
  1000.   
  1001.   set the itemDelimiter = ","
  1002. end
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011. on HtmlPath
  1012.   temp = gDispatcher.getHTMLPath()
  1013.   --  set temp = the pathname
  1014.   --  if the machinetype = 256 then
  1015.   --    repeat with x = 1 to the number of chars in temp
  1016.   --      if char x of temp = "\" then
  1017.   --        put "/" into char x of temp
  1018.   --      end if
  1019.   --    end repeat
  1020.   --  else
  1021.   --    repeat with x = 1 to the number of chars in temp
  1022.   --      if char x of temp = ":" then
  1023.   --        put "/" into char x of temp
  1024.   --      end if
  1025.   --    end repeat
  1026.   --  end if
  1027.   return temp
  1028. end 
  1029.  
  1030.  
  1031. on showHtml which
  1032.   gDispatcher.showHTML(which)
  1033.   --  cursor 4
  1034.   --  -- SKB 6/20/99  gotoNetPage "file:///" & htmlPath() & "index.htm"
  1035.   --  gotoNetPage "file:///" & htmlPath() & "Library/articles/" & which
  1036.   --  cursor 0
  1037.   
  1038. end
  1039.  
  1040.  
  1041. on pCredits whichFrame
  1042.   set gReturn = the framelabel
  1043.   goto whichFrame, "photo_credits"
  1044. end
  1045.  
  1046. on showtrans whichtext
  1047.   open window "Text"
  1048.   set the windowtype of window "Text" = 4
  1049.   --  tell window "Text" to put "" into field "info"
  1050.   --  temp = the text of member whichtext
  1051.   tell window "Text" to set the member of sprite 3 =  member whichtext
  1052.   tell window "Text" to sendSprite(10, #CustomScrollbar_SwapMember,the member of sprite 3)
  1053.   tell window "Text" to sendSprite(11, #CustomScrollbar_SwapMember,the member of sprite 3)
  1054.   tell window "Text" to sendSprite(12, #CustomScrollbar_SwapMember,the member of sprite 3)
  1055.   tell window "Text" to sendSprite(13, #CustomScrollbar_SwapMember,the member of sprite 3)
  1056.   tell window "Text" to set the scrolltop of the member of sprite 3 to 0
  1057. end
  1058.  
  1059.  
  1060.  
  1061.  
  1062. on playmovie whichMovie
  1063.   set gReturn = the framelabel
  1064.   go "movie"
  1065.   set the member of sprite 3 = whichMovie
  1066.   set the controller of the member of sprite 3 = true
  1067.   updatestage
  1068.   set the visible of sprite 3 = true
  1069.   updatestage
  1070.   set the movierate of sprite 3 = 1
  1071. end
  1072.  
  1073. on setmov
  1074.   repeat with x = 57 to 101
  1075.     set the preload of member x = true
  1076.     set the controller of member x = false
  1077.   end repeat
  1078. end
  1079.  
  1080.  
  1081. on goto whichFrame, whichmovie, stage
  1082.   gDispatcher.goto(whichFrame,whichmovie)
  1083. end
  1084.  
  1085. --on stagegoto whichFrame, whichmovie
  1086. --  gTargetFrame = whichFrame
  1087. --  gTargetMovie = whichMovie
  1088. --  gDispatcher.stagegoto(gTargetFrame,gTargetMovie)
  1089. --  --  if value(whichFrame) <> void then set whichFrame = value(whichFrame)
  1090. --  --  if whichmovie = void or the movie contains whichmovie then 
  1091. --  --    set whichMovie = the movie
  1092. --  --    cursor 4
  1093. --  --    tell the stage to go whichFrame
  1094. --  --    cursor 0
  1095. --  --  else
  1096. --  --    cursor 4
  1097. --  --    tell the stage to set the visible of sprite 53 to FALSE
  1098. --  --    tell the stage to set the visible of sprite 54 to FALSE
  1099. --  --    tell the stage to set the visible of sprite 55 to FALSE
  1100. --  --    tell the stage to set the visible of sprite 56 to FALSE
  1101. --  --    tell the stage to go whichframe of movie whichmovie
  1102. --  --  end if
  1103. --  --  set where = whichFrame & "*" & whichMovie
  1104. --  --  add(gRetraceList, where)
  1105. --  --  cursor 0
  1106. --end
  1107.  
  1108.  
  1109. on btnDown whSprite
  1110.   if  whSprite = void then set whSprite = the clickon
  1111.   if the name of the member of sprite whSprite contains "_h" then
  1112.     set the membernum of sprite whSprite = (the memberNum of sprite whSprite) +2
  1113.     updatestage
  1114.   end if
  1115.   repeat while the mousedown
  1116.     if not rollover(whSprite) then
  1117.       if the name of the member of sprite whSprite contains "_d" then
  1118.         set the membernum of sprite whSprite = (the memberNum of sprite whSprite) -2
  1119.         updatestage
  1120.       end if
  1121.       exit
  1122.     end if
  1123.   end repeat
  1124.   if the name of the member of sprite whSprite contains "_d" then
  1125.     set the membernum of sprite whSprite = (the memberNum of sprite whSprite) -2
  1126.     updatestage
  1127.   end if
  1128. end
  1129.  
  1130. on BtnUp whichSprite
  1131.   if  whichsprite = void then set whichSprite = the clickon
  1132.   if the name of the member of sprite whichSprite contains "_d" then
  1133.     set the memberNum of sprite whichSprite = (the memberNum of sprite whichSprite) -2
  1134.   end if
  1135.   updatestage
  1136. end
  1137.  
  1138. on roll x
  1139.   if the memberNum of sprite  x = 0 then exit
  1140.   if the name of the member of sprite x contains "_n" then
  1141.     set the memberNum of sprite x = (the memberNum of sprite x) - 1
  1142.   end if
  1143. end
  1144.  
  1145. on unroll x
  1146.   if the memberNum of sprite  x = 0 then exit
  1147.   if the name of the member of sprite x contains "_h" then
  1148.     set the memberNum of sprite x = (the memberNum of sprite x) + 1
  1149.   else
  1150.     if the name of the member of sprite x contains "_d" then
  1151.       set the memberNum of sprite x = (the memberNum of sprite x) - 1
  1152.     end if
  1153.   end if
  1154. end